package com.zl.dplayer.springbootdplayerdemo.controller;

import cn.hutool.json.JSONUtil;
import com.zl.dplayer.springbootdplayerdemo.constant.DPlayerConstants;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ZhangLiang
 * @Date: 2021/08/20/16:48
 * @Description:
 */
@RestController
@RequestMapping(value = "barrage")
public class BarrageController {

    @GetMapping(value = "v3")
    public String getV3(@RequestParam String id) {
        System.out.println(id);
        Map map = new HashMap();
        List data = new ArrayList();
        data.add(DPlayerConstants.barrage_init(data));
        DPlayerConstants.DPLAYER_BARRAGE_TEXT="我是第二条弹幕";
        data.add(DPlayerConstants.barrage_init(data));
        DPlayerConstants.DPLAYER_BARRAGE_TEXT="我是第san条弹幕";
        data.add(DPlayerConstants.barrage_init(data));
        DPlayerConstants.DPLAYER_BARRAGE_TEXT="我是第四条弹幕";
        data.add(DPlayerConstants.barrage_init(data));
        DPlayerConstants.DPLAYER_BARRAGE_TEXT="我是第五条弹幕";
        data.add(DPlayerConstants.barrage_init(data));
        DPlayerConstants.DPLAYER_BARRAGE_TEXT="我是第六条弹幕";
        data.add(DPlayerConstants.barrage_init(data));

        map.put("code", DPlayerConstants.DPLAYER_SUCCESS_CODE);
        map.put("data",data);

        System.out.println(JSONUtil.toJsonStr(map));
        return JSONUtil.toJsonStr(map);
    }
}
